<template>
	<view class="">
		<view class="payway_box">
			<view class="payway_box_title">
				选择支付方式
			</view>
			<view class="payway_box_content">
				<radio-group @change="radioChange">
					<view class='payway_content_list' v-for='(item,index) in wayList' :key='index'@click="choosePayWay(item)"  >
						<view class="img_left">
							<image :src='item.url'></image>
							<text style="margin-left: 10rpx;">{{item.name}}</text>
						</view>
						<view>
							<radio :value="item.value" :checked="index === current" color="#f62442" />
						</view>
					</view>
				</radio-group>
<!--				<view class="payway_box_more" v-if="flagMore" @click="handleTabMore">-->
<!--					更多支付方式 <text class="icon-jiantouxia iconfont" style="font-size: 24rpx;color: #999; "></text>-->
<!--				</view>-->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			// canvas 宽度
			is_show_share_box: {
				type: Boolean,
				default: false
			},
      wayList:{
			  type:Array,
        dafault:false
      }
		},
		data() {
			return {

				current: 0,
				flagMore: true,
				// wayList: [
				// ],
				wayListMore: [{
						value: "1",
						name: "微信支付",
						url: "/static/wx_pay.png",
					},
					{
						value: "2",
						name: "支付宝",
						url: "/static/zfb_pay.png",
					},
					{
						value: "3",
						name: "银联支付",
						url: "/static/yl_pay.png",
					},
				],




			};
		},
		methods: {

			radioChange: function(evt) {
				for (let i = 0; i < this.wayList.length; i++) {
					if (this.wayList[i].value === evt.target.value) {
						this.current = i;
						break;
					}
				}
			},
			//
			choosePayWay(item) {
        this.$emit('choosePayWay', item)
        this.current =item.value-1
			},
			//
			handleTabMore() {
				this.wayList = this.wayListMore;
				this.flagMore = false;
			},

		},

		mounted() {

		}

	};
</script>

<style lang="scss">
	.payway_box {
		margin-top: 20rpx;
		height: 100%;
		background-color: #fff;

		.payway_box_title {
			color: #999;
			font-size: 26rpx;
			margin: 20rpx;
			height: 60rpx;
			line-height: 60rpx;
			padding-left: 20rpx;
			// padding: 20rpx;
			border-bottom: 1px solid #eee;
		}

		.payway_box_content {
			width: 100%;
			height: 100%;

			.payway_box_more {
				font-size: 24rpx;
				text-align: center;
				height: 50rpx;
			}

			.payway_content_list {
				display: flex;
				justify-content: space-between;
				padding: 20rpx;
				margin: 20rpx;
				border-bottom: 1px solid #eee;

				.img_left {
					height: 65rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;

					image {
						width: 60rpx;
						height: 100%;
					}
				}
			}
		}
	}
</style>
